package com.vancouver.knows.ui.activity.my;

import android.os.Bundle;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.vancouver.knows.business.Constants;
import com.vancouver.knows.ui.base.BaseFragment;

/**
 * 关注子内容
 * 
 * @author llf
 * 
 */
public class FollowedChildrenFragment extends BaseFragment {

	public static final int FOLLOWED_TYPE_ALL = 0;
	public static final int FOLLOWED_TYPE_CITY_NEWS = 1;
	public static final int FOLLOWED_TYPE_EVENTS = 2;
	public static final int FOLLOWED_TYPE_SHOP = 3;

	private FollowedPullControllerView followedListView;

	public static FollowedChildrenFragment newInstance(int type) {
		FollowedChildrenFragment fragment = new FollowedChildrenFragment();
		Bundle bundle = new Bundle();
		bundle.putInt("type", type);
		fragment.setArguments(bundle);

		return fragment;
	}

	@Override
	protected View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		int type = getArguments().getInt("type", FOLLOWED_TYPE_ALL);
		followedListView = new FollowedPullControllerView(getActivity());
		followedListView.loadData(type);

		return followedListView;
	}

	@Override
	protected void bindView(View rootView) {
	}

	@Override
	public void subHandleMessage(Message msg) {
		super.subHandleMessage(msg);

		switch (msg.what) {
		case Constants.BUSINESS_STATUS_USER_DELETE_FOLLOW:
			if (followedListView != null) {
				followedListView.flush();
			}
			break;

		}
	}
}
